//
//  ZXY_DownFileOperation.h
//  DLNetSchool
//
//  Created by 宇周 on 15/8/22.
//  Copyright (c) 2015年 宇周. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ZXY_DownItem.h"
@protocol ZXY_DownFileOperationDelegate <NSObject>

- (void)giveYouRadio:(float)radio aboutItem:(ZXY_DownItem *)currentItem;
- (void)downLoadSuccessOfItem:(ZXY_DownItem *)currentItem;
- (void)cancelDownItem:(ZXY_DownItem *)cancelItem;
- (void)failDownItem:(ZXY_DownItem *)failItem;
- (void)cancelAllTask;



@end

@interface ZXY_DownFileOperation : NSObject
@property(nonatomic , weak)id<ZXY_DownFileOperationDelegate>delegate;
@property(assign)BOOL isFailGOON; // 如果失败是否可以继续下一次下载

/**
 * gets singleton object.
 * @return singleton
 */
+ (ZXY_DownFileOperation*)sharedInstance;

/**
 *  暂停一个下载对象
 *
 *  @param pausedItem  需要暂停的对象
 *  @param pausedBlock 暂停之后执行的方法
 */
- (void)pausedItem:(ZXY_DownItem *)pausedItem withBlock:(void (^) (ZXY_DownItem *item)) pausedBlock;

/**
 *  取消一个下载对象
 *
 *  @param cacelItem   需要取消的对象
 *  @param cancelBlock 取消下载之后的方法
 */
- (void)cancelItem:(ZXY_DownItem *)cacelItem withBlock:(void(^)(ZXY_DownItem *item)) cancelBlock;

/**
 *  增加一个下载线程,开始下载
 */
- (void)startDownFile:(ZXY_DownItem *)item;
- (void)stopAllDownFile;
@end
